$\newcommand{\lode}{\mathbb{LODE}}$\lode is an instance of
the node command line REPL which has all of the LDE commands and supporting
utilities preloaded. This is useful for debugging and experimenting with the
functions and classes defined in the repository. This initialized version of
node
can be thought of as Lurch node
, or simply $\lode$ for short.
Running $\lode$
To run $\lode$ from the command line in a terminal from the src/experimental/
subfolder the command node lode
. (If you have not yet set up a copy
of this repository with the appropriate Node.js version installed, see
our GitHub README, which explains
how to do so.)
> node lode
Welcome to šš šš - the Lurch Node app
(type .help for help)
ā¶ļø
You are now at the Lurch Node REPL command prompt. All of the exported modules in
the src/index.js file in this repository and all of the utilities useful tools from the experimental
folder are available at the $\lode$ prompt. For example, you can now do things like this (see LogicConcept and toPutdown):
Welcome to šš šš - the Lurch Node app
(type .help for help)
ā¶ļø LogicConcept.fromPutdown(`{ :Hello ( World ! ) }`)[0].toPutdown()
'{ :Hello (World !) }'
ā¶ļø
Since creating and viewing LogicConcepts in putdown notation is often what we want, $\lode$ provides a shortcut for constructing LCs and displays LCs in Putdown notation by default.
ā¶ļø LogicConcept.fromPutdown(`{ :Hello ( World ! ) }`)[0].toPutdown()
'{ :Hello (World !) }'
ā¶ļø lc(`{ :Hello ( World ! ) }`) // constructs the same thing
{ :Hello (World !) }
There is also a more user friendly parser that supports features of asciimath http://asciimath.org. This allows you to construct LogicConstructs like this
ā¶ļø $(`forall x. 0 leq x implies x^2+1 leq (x+1)^2`)
(ā x , (ā (< 0 x) (ā¤ (+ (^ x 2) 1) (^ (+ x 1) 2))))
and also accepts unicode input
ā¶ļø $(`āx. 0ā¤x ā x^2+1ā¤(x+1)^2`)
(ā x , (ā (< 0 x) (ā¤ (+ (^ x 2) 1) (^ (+ x 1) 2))))
If you validate a document in $\lode$ the result can be displayed in many different ways, including syntax highlighting.
To run the test suite simply type the command .test
. This loads numerous example documents in the array acid
.
ā¶ļø .test
Loading the acid tests ...
Parser Test: ā ok
Test 0: (END Example 1) If PāQ then Ā¬PāØQ.
Test 0.0 ā ok
Test 1: (END Example 4) If āx,āy,Q(x,y) then āy,āx,Q(x,y)
Test 1.0 ā ok
:
(omitted)
:
Test 22: Math 299 Midterm Exam Proofs 2023
Test 22.0 ā ok
50 tests passed - 0 tests failed
904 green checks
58 red marks
Test result stored in the array 'acid'
To view a document in various formats you can use the .report()
command with various options (all
)
ā¶ļø acid[1].report(user)
{
42 (END Example 4) If āx,āy,Q(x,y) then āy,āx,Q(x,y)
43 {
Thm 4: If āx,āy,Q(x,y) then āy,āx,Q(x,y)
{ :(ā x , (ā y , (Q x y))) (ā y , (ā x , (Q x y)))āļø }āļø
Proof:
{
:(ā x , (ā y , (Q x y)))
{
:Let[z]
ForSome[c , (ā y , (Q c y))]āļø
(Q c z)āļø
(ā x , (Q x z))āļø
}āļø
(ā y , (ā x , (Q x y)))āļø
}āļø
}āļø
}āļø
You can use .list
to see a list of current files and libraries and load a document with the commands loadDoc()
and initialize()
.
ā¶ļø doc = loadDoc('proofs/math299/midterm')
{
:Declare[š ā¤]
:Declare[and or ā ā Ā¬ āā]
:Declare[ā ā ā! =]
:Declare[0 Ļ + ā
ā¤]
:Declare[1 2 3 4 5 | prime]
:{ { :{ W V } (and W V) } { :(and W V) { W V } } }
:{ { :{ :W V } (ā W V) } { :(ā W V) { :W V } } }
:
(omitted)
:
(ā (ā y , (Ā¬ (loves y s))) (ā y , (Ā¬ (loves s y))))āļø
}āļø
(ā x , (ā (ā y , (Ā¬ (loves y x))) (ā y , (Ā¬ (loves x y)))))āļø
}āļø
}āļø
}āļø
}āļø
The command .makedocs
builds the jsdoc documentation for the experimental
folder.
There are many other features available. You can type .features
in $\lode$ to see the current list of features.